package com.zzy.j1114iocdemo.config;

import com.zzy.j1114iocdemo.model.UserInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;


@Configuration
public class BeanConfig {
    @Primary
    @Bean("u1")
    public UserInfo userInfo1(){
        UserInfo userInfo = new UserInfo();
        userInfo.setAge(18);
        userInfo.setName("张三");
        return userInfo;
    }

    @Bean("u2")
    public UserInfo userInfo2(){
        UserInfo userInfo2 = new UserInfo();
        userInfo2.setAge(19);
        userInfo2.setName("李四");
        return userInfo2;
    }
}
